Imports System.Collections
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text

Imports System.Linq
Imports System.Linq.Expressions

Class DbfQuery(Of TRecord As {DbfRecord, New})
	Implements IQueryable(Of TRecord)
	Private mExpression As Expression
	Private mTable As DbfTable(Of TRecord)

	Public Sub New(table As DbfTable(Of TRecord), expression As Expression)
		mTable = table
		mExpression = expression
	End Sub


	#Region "IEnumerable<TRecord> Members"

	Private Function IEnumerable_GetEnumerator() As IEnumerator(Of TRecord) Implements IEnumerable(Of TRecord).GetEnumerator
		Return Nothing
		' this is where the fun starts
		'var mIndices = mTable.o.OpenIndexes;
		'if (mIndices.Length == 0)
		'{
		'    return mTable.GetEnumerator();
		'}
		'else
		'{
		'    DbfIndex<TRecord> index = mTable.OpenIndexes[0];
		'    return index.GetEnumerator();
		'}
	End Function

	#End Region

	#Region "IEnumerable Members"

	Private Function System_Collections_IEnumerable_GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
		Throw New NotImplementedException()
	End Function

	#End Region

	#Region "IQueryable Members"

	Private ReadOnly Property IQueryable_ElementType() As Type Implements IQueryable.ElementType
		Get
			Throw New NotImplementedException()
		End Get
	End Property

	Private ReadOnly Property IQueryable_Expression() As System.Linq.Expressions.Expression Implements IQueryable.Expression
		Get
			Return mExpression
		End Get
	End Property

	Private ReadOnly Property IQueryable_Provider() As IQueryProvider Implements IQueryable.Provider
		Get
			Return mTable
		End Get
	End Property

	#End Region
End Class
